const lessons = [
  {
    title: "媒体查询响应式布局",
    category: "css"
  },
  {
    title: "FLEX 弹性盒模型",
    category: "css"
  },
  {
    title: "MYSQL多表查询随意操作",
    category: "mysql"
  }
];
let res = lessons.reduce((obj, cur, index) => {
  obj[`${cur["category"]}-${index}`] = cur;
  return obj;
}, {});
console.log(JSON.stringify(res, null, 2));

function upload(params) {
  let options = {
    size: 333
  };
  options = Object.assign(options, params);
  console.log(JSON.stringify(options, null, 2));
}
upload({ size: 99, type: "jpeg" });
